/**
 * Keafmd
 *
 * @ClassName: Demo3
 * @Description: Demo3
 * @author: lijl
 * @date: 2022/12/11 14:27
 * @Blog: https://keafmd.blog.csdn.net/
 */
class Ball{
    private double r;
    public void setR(double r){
        this.r = r;
    }
    double getR(){
        return r;
    }
}
class Billiards extends Ball{
    private String color;
    public void setColor(String color){
        this.color = color;
    }
    public void show(){
        System.out.println("台球的颜色是"+color+",半径是"+getR());
    }
}
public class Demo3 {
    public static void main(String[] args) {
        Ball ball = new Ball();
        ball.setR(2);
        System.out.println(ball.getR());
        Billiards billiards = new Billiards();
        billiards.setR(3);
        billiards.setColor("blue");
        billiards.show();
    }
}
